import 'package:city_pickers/city_pickers.dart';
import 'package:city_pickers/modal/result.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_switch/flutter_switch.dart';
import 'package:shenfuhui/config/config.dart';

import '../routers/routers.dart';
import '../views/dialog_manager.dart';

///
/// 修改绑定手机号
///
class MineChangeMobile extends StatefulWidget {
  MineChangeMobile({Key? key}) : super(key: key);

  @override
  State<MineChangeMobile> createState() => _MineChangeMobileState();
}

class _MineChangeMobileState extends State<MineChangeMobile> {
  var _name = "";
  int _type = 1;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Config.colorBg2,
      appBar: AppBar(
        title: Text("修改绑定手机"),
        centerTitle: true,
      ),
      body: SizedBox(
        width: double.infinity,
        height: double.infinity,
        child: Stack(
          children: [
            Visibility(
              visible: _type == 1,
              child: Container(
                width: double.infinity,
                height: double.infinity,
                margin: EdgeInsets.symmetric(vertical: 25.w, horizontal: 25.w),
                child: Column(
                  children: [
                    Container(
                      width: double.infinity,
                      padding: EdgeInsets.symmetric(
                          vertical: 20.w, horizontal: 20.w),
                      decoration: BoxDecoration(
                        color: (Config.colorWhite),
                        borderRadius: BorderRadius.circular(10.w),
                      ),
                      child: Column(
                        children: [
                          Row(
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: [
                              Container(
                                margin: EdgeInsets.symmetric(vertical: 8.w),
                                width: 140.w,
                                child: Text(
                                  "当前手机号",
                                  style: TextStyle(fontSize: 25.sp),
                                ),
                              ),
                              Padding(
                                padding: EdgeInsets.only(left: 30.w),
                              ),
                              Container(
                                width: 480.w,
                                margin: EdgeInsets.symmetric(vertical: 8.w),
                                child: TextField(
                                  keyboardType: TextInputType.text,
                                  textAlign: TextAlign.justify,
                                  obscureText: false,
                                  maxLength: 20,
                                  maxLines: 1,
                                  onChanged: (value) {
                                    setState(() {
                                      _name = value;
                                    });
                                  },
                                  style: TextStyle(
                                      fontSize: 25.sp,
                                      color: Config.colorText1),
                                  decoration: const InputDecoration(
                                    hintStyle:
                                        TextStyle(color: Config.colorText3),
                                    hintText: "请输入当前手机号",
                                    counterText: '',
                                    isDense: true,
                                    border: InputBorder.none,
                                    contentPadding:
                                        EdgeInsets.zero, //设置文本内容的Padding
                                  ),
                                ),
                              ),
                            ],
                          ),
                          Divider(
                            color: Config.colorDivider,
                            height: 40.w,
                            thickness: 2.w,
                          ),
                          Row(
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: [
                              Container(
                                margin: EdgeInsets.symmetric(vertical: 8.w),
                                width: 140.w,
                                child: Text(
                                  "验证码",
                                  style: TextStyle(fontSize: 25.sp),
                                ),
                              ),
                              Padding(
                                padding: EdgeInsets.only(left: 30.w),
                              ),
                              Row(
                                children: [
                                  Container(
                                    width: 360.w,
                                    margin: EdgeInsets.symmetric(vertical: 8.w),
                                    child: TextField(
                                      keyboardType: TextInputType.text,
                                      textAlign: TextAlign.justify,
                                      obscureText: false,
                                      maxLength: 20,
                                      maxLines: 1,
                                      onChanged: (value) {
                                        setState(() {
                                          _name = value;
                                        });
                                      },
                                      style: TextStyle(
                                          fontSize: 25.sp,
                                          color: Config.colorText1),
                                      decoration: const InputDecoration(
                                        hintStyle:
                                            TextStyle(color: Config.colorText3),
                                        hintText: "请输入验证码",
                                        counterText: '',
                                        isDense: true,
                                        border: InputBorder.none,
                                        contentPadding:
                                            EdgeInsets.zero, //设置文本内容的Padding
                                      ),
                                    ),
                                  ),
                                  Text(
                                    "获取验证码",
                                    style: TextStyle(
                                      color: Config.colorMain,
                                      fontSize: 22.sp,
                                    ),
                                  ),
                                ],
                              ),
                            ],
                          ),
                        ],
                      ),
                    ),
                    Container(
                      width: 750.w,
                      height: 96.w,
                      padding:
                          EdgeInsets.symmetric(vertical: 8.w, horizontal: 8.w),
                      margin: EdgeInsets.only(top: 45.w),
                      child: ElevatedButton(
                        clipBehavior: Clip.antiAlias,
                        onPressed: () {
                          setState(() {
                            _type = 2;
                          });
                        },
                        style: ElevatedButton.styleFrom(
                            shape: const StadiumBorder()),
                        child: const Text('下一步'),
                      ),
                    ),
                  ],
                ),
              ),
            ),
            Visibility(
              visible: _type == 2,
              child: Container(
                width: double.infinity,
                height: double.infinity,
                margin: EdgeInsets.symmetric(vertical: 25.w, horizontal: 25.w),
                child: Column(
                  children: [
                    Container(
                      width: double.infinity,
                      padding: EdgeInsets.symmetric(
                          vertical: 20.w, horizontal: 20.w),
                      decoration: BoxDecoration(
                        color: (Config.colorWhite),
                        borderRadius: BorderRadius.circular(10.w),
                      ),
                      child: Column(
                        children: [
                          Row(
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: [
                              Container(
                                margin: EdgeInsets.symmetric(vertical: 8.w),
                                width: 140.w,
                                child: Text(
                                  "新手机号",
                                  style: TextStyle(fontSize: 25.sp),
                                ),
                              ),
                              Padding(
                                padding: EdgeInsets.only(left: 30.w),
                              ),
                              Container(
                                width: 480.w,
                                margin: EdgeInsets.symmetric(vertical: 8.w),
                                child: TextField(
                                  keyboardType: TextInputType.text,
                                  textAlign: TextAlign.justify,
                                  obscureText: false,
                                  maxLength: 20,
                                  maxLines: 1,
                                  onChanged: (value) {
                                    setState(() {
                                      _name = value;
                                    });
                                  },
                                  style: TextStyle(
                                      fontSize: 25.sp,
                                      color: Config.colorText1),
                                  decoration: const InputDecoration(
                                    hintStyle:
                                        TextStyle(color: Config.colorText3),
                                    hintText: "请输入新手机号",
                                    counterText: '',
                                    isDense: true,
                                    border: InputBorder.none,
                                    contentPadding:
                                        EdgeInsets.zero, //设置文本内容的Padding
                                  ),
                                ),
                              ),
                            ],
                          ),
                          Divider(
                            color: Config.colorDivider,
                            height: 40.w,
                            thickness: 2.w,
                          ),
                          Row(
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: [
                              Container(
                                margin: EdgeInsets.symmetric(vertical: 8.w),
                                width: 140.w,
                                child: Text(
                                  "验证码",
                                  style: TextStyle(fontSize: 25.sp),
                                ),
                              ),
                              Padding(
                                padding: EdgeInsets.only(left: 30.w),
                              ),
                              Row(
                                children: [
                                  Container(
                                    width: 360.w,
                                    margin: EdgeInsets.symmetric(vertical: 8.w),
                                    child: TextField(
                                      keyboardType: TextInputType.text,
                                      textAlign: TextAlign.justify,
                                      obscureText: false,
                                      maxLength: 20,
                                      maxLines: 1,
                                      onChanged: (value) {
                                        setState(() {
                                          _name = value;
                                        });
                                      },
                                      style: TextStyle(
                                          fontSize: 25.sp,
                                          color: Config.colorText1),
                                      decoration: const InputDecoration(
                                        hintStyle:
                                            TextStyle(color: Config.colorText3),
                                        hintText: "请输入验证码",
                                        counterText: '',
                                        isDense: true,
                                        border: InputBorder.none,
                                        contentPadding:
                                            EdgeInsets.zero, //设置文本内容的Padding
                                      ),
                                    ),
                                  ),
                                  Text(
                                    "获取验证码",
                                    style: TextStyle(
                                      color: Config.colorMain,
                                      fontSize: 22.sp,
                                    ),
                                  ),
                                ],
                              ),
                            ],
                          ),
                        ],
                      ),
                    ),
                    Container(
                      width: 750.w,
                      height: 96.w,
                      padding:
                          EdgeInsets.symmetric(vertical: 8.w, horizontal: 8.w),
                      margin: EdgeInsets.only(top: 45.w),
                      child: ElevatedButton(
                        clipBehavior: Clip.antiAlias,
                        onPressed: () => {},
                        style: ElevatedButton.styleFrom(
                            shape: const StadiumBorder()),
                        child: const Text('确定'),
                      ),
                    ),
                  ],
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
